package j_util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*

    This file is part of Logica-Logike.

    Logica-Logike is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation version 3 of the License.

    Logica-Logike is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Logica-Logike.  If not, see <http://www.gnu.org/licenses/>.

 */
/**
 * @author Jose Martin Rozanec;
 */
public class KeyboardInput {
    public static String text(String message) {
        try {
            System.out.println(message);
            return new BufferedReader(
                    new InputStreamReader(System.in)).readLine();
        }
        catch (IOException e) {
            System.out.println(e);
            System.exit(1);
            return e.toString();
        }
    }

/* Metodo que permite entrar UN character y, como el anterior, se le pasa como
argumento el text para solicitar dicho character */

    public static char character(String message) {
        return text(message).charAt(0);
    }


    public static int integerValue(String message) {
        return new Integer(text(message));

    }


    public static long longValue(String message) {
        return new Long(text(message));

    }


    public static float floatValue(String message) {
        return new Float(text(message));

    }


    public static double doubleValue(String message) {
        return new Double(text(message));
    }
}
